package co.yixiang.weixin.biz.controller;

import co.yixiang.weixin.biz.service.WeixinPayService;
import co.yixiang.weixin.common.dto.WxPayDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/weixinPay")
public class WeixinPayController {
    @Autowired
    private WeixinPayService weixinPayService;

    @PostMapping("/goPay")
    public Map<String, Object> goPay(@RequestBody WxPayDto wxPayDto){
        return weixinPayService.goPay(wxPayDto.getMap(),wxPayDto.getOrderId(),wxPayDto.getUid(),wxPayDto.getPayType(),wxPayDto.getFrom(),wxPayDto.getOrderDTO());
    }

    @PostMapping("/unifyPay")
    public Object unifyPay(@RequestParam String orderId, @RequestParam String from,
                                        @RequestParam String attach, @RequestParam String body){
        return weixinPayService.unifyPay(orderId,from,attach,body);
    }
}
